using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using Yoozoo.UI;
public class InputFieldBinderTreeItem : BindingBinderTreeItemBase
{
    public static Dictionary<InputFieldBinder.AttributeType, LinkerValueState> AttributeValueDic = new Dictionary<InputFieldBinder.AttributeType, LinkerValueState>
    {
        {InputFieldBinder.AttributeType.shouldHideMobileInput, LinkerValueState.Boolean},
        {InputFieldBinder.AttributeType.text, LinkerValueState.String},
        {InputFieldBinder.AttributeType.caretBlinkRate, LinkerValueState.Single},
        {InputFieldBinder.AttributeType.caretWidth, LinkerValueState.Int32},
        {InputFieldBinder.AttributeType.caretColor, LinkerValueState.Color},
        {InputFieldBinder.AttributeType.customCaretColor, LinkerValueState.Boolean},
        {InputFieldBinder.AttributeType.selectionColor, LinkerValueState.Color},
        {InputFieldBinder.AttributeType.onEndEdit, LinkerValueState.UnityEventString},
        {InputFieldBinder.AttributeType.onValueChanged, LinkerValueState.UnityEventString},
        {InputFieldBinder.AttributeType.characterLimit, LinkerValueState.Int32},
        {InputFieldBinder.AttributeType.readOnly, LinkerValueState.Boolean},
        {InputFieldBinder.AttributeType.asteriskChar, LinkerValueState.Char},
        {InputFieldBinder.AttributeType.caretPosition, LinkerValueState.Int32},
        {InputFieldBinder.AttributeType.selectionAnchorPosition, LinkerValueState.Int32},
        {InputFieldBinder.AttributeType.selectionFocusPosition, LinkerValueState.Int32},
        {InputFieldBinder.AttributeType.interactable, LinkerValueState.Boolean},
        {InputFieldBinder.AttributeType.enabled, LinkerValueState.Boolean},
    };
    public InputFieldBinderTreeItem() : base(typeof(InputFieldBinder))
    {
    }
    
    public override void RebuildTree()
    {
        base.RebuildTree();
        foreach (InputFieldBinder.AttributeType binderType in Enum.GetValues(typeof(InputFieldBinder.AttributeType)))
        {
            BindingLinkerTreeItem linkerTreeItem = new BindingLinkerTreeItem(binderType.ToString(), binderType.ToString(), (int)AttributeValueDic[binderType]);
            AddChild(linkerTreeItem);
        }
    }
}